export const Index = dom => {
	const form = document.querySelector( dom ? dom : '.pre-form')
	if( !form ) return
	setTimeout(()=>{
		form.querySelector('textarea').onkeydown = function(e){
			if (e.keyCode === 9){
				e.preventDefault()
				var indent = '	'
				var start = this.selectionStart
				var end = this.selectionEnd
				var selected = window.getSelection().toString()
				selected = indent + selected.replace(/\n/g, '\n' + indent)
				this.value = this.value.substring(0, start) + selected + this.value.substring(end)
				this.setSelectionRange(start + indent.length, start + selected.length)
			}
		}
	},500)
}
export default Index